package com.raa.core;

public class ObjectWrapper {

	private Object object;
	private final String vidPrefix;

	public ObjectWrapper (Object object) {
		this.object = object;
		this.vidPrefix = String.format("%s", System.currentTimeMillis());
	}

	public Object getObject ( ) {
		return object;
	}

	public String getValidateId(ActionTable actionTable, Validator validator) {
		// 生成规则: [timestamp]#[object.hashCode]@[actionTable.hashCode]/[validator.hashCode]
		return String.format("%s#%s@%s/%s",
				this.vidPrefix,
				this.object != null ? this.object.hashCode() : "0",
				actionTable != null ? actionTable.hashCode() : "0",
				validator != null ? validator.hashCode() : "0");
	}
}
